package com.xuduo.amd.service.impl;

import com.xuduo.amd.dao.EamBusinessDao;
import com.xuduo.amd.service.BusinessManagerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.*;

@Service
public class BusinessManagerServiceImpl implements BusinessManagerService {
    @Autowired
    private EamBusinessDao eamBusinessDao;

    @Override
    public Map<String, Object> selectSysInfo() {
        List<Map<String,String>> result=eamBusinessDao.selectSys();
        Set<String> key1 =new HashSet<>();
        Set<String> key2 =new HashSet<>();
        Set<String> key3 =new HashSet<>();
        Set<String> key4 =new HashSet<>();
        Set<String> key5 =new HashSet<>();
        Set<String> key6 =new HashSet<>();
        for (int i =0;i<result.size();i++){
            if (!StringUtils.isEmpty(result.get(i))){
                key1.add(result.get(i).get("dept_dev"));
                key2.add(result.get(i).get("block_strategy"));
                key3.add(result.get(i).get("sys_lvl"));
                key4.add(result.get(i).get("sys_group"));
                key5.add(result.get(i).get("status"));
                key6.add(result.get(i).get("dept_dev"));
            }
        }
        Map<String,Object> result2=new HashMap<>();
        result2.put("dept_dev",key1);
        result2.put("block_strategy",key2);
        result2.put("sys_lvl",key3);
        result2.put("sys_group",key4);
        result2.put("status",key5);
        result2.put("dept_dev",key6);


        return result2;
    }

    @Override
    public List<Map<String, String>> like(String name) {
        List<Map<String,String>> result=eamBusinessDao.like(name);
        return result;
    }
}
